package stack

import (
	"reflect"
	"unsafe"
)

func GetAt[T interface{}](p uintptr) T {
	return *(*T)(unsafe.Pointer(p))
}

func SliceToSliceHeader(b []byte) reflect.SliceHeader {
	return *((*reflect.SliceHeader)(unsafe.Pointer(&b)))
}

func GetValueByPointerAndOffset[T interface{}](p uintptr, offset uintptr) T {
	return *((*T)(unsafe.Pointer(p + offset)))
}
